package app;

import beans.Socio;
import dao.SimpleSessionFactory;
import java.util.List;
import org.hibernate.Query;
import org.hibernate.Session;
import org.hibernate.SessionFactory;


public class App {
	public static void main(String[] args) {
            SessionFactory sf = SimpleSessionFactory.getSessionFactory(null);
            Session session = sf.openSession();
            session.beginTransaction();
            Query q = session.createQuery("from Socio soc where soc.legajo = :legajo and soc.boliche.id = :boliche");
            q.setString("legajo", "10");
            q.setInteger("boliche", 2);
            List result = q.list();
            for (Object obj : result) {
                Socio retorno = (Socio) obj;
                System.out.println(retorno.getApellido());
            }

            session.close();
        }

}
